package com.leetcode.test.tree;

/**
 * 二叉树测试
 */
public class 二叉树Case {

	protected static class TreeNode extends TreeNodeT<Integer, TreeNode> {
		TreeNode(Integer x) {
			super(x);
		}
	}

	protected static class CharTreeNode extends TreeNodeT<Character, CharTreeNode> {

		CharTreeNode(Character x) {
			super(x);
		}
	}

	protected static class TreeNodeT<T, U extends TreeNodeT> {
		T val;
		U left;
		U right;

		TreeNodeT(T x) { val = x; }

		@Override
		public String toString() {
			return "{" +
					"val=" + val +
					", left=" + (left == null ? "" : left.val) +
					", right=" + (right == null ? "" : right.val) +
					'}';
		}
	}
}
